/*
 * @Author: YSM
 * @Description:路由
 * @Date: 2023-06-28 21:37:13
 * @LastEditTime: 2024-10-14 16:18:56
 * @FilePath: \chongqing-analysis-visualization-platformd:\work\my_web_knowledge\my_vue2_demo\src\router\index.js
 */
// 引入
import Vue from "vue";
import VueRouter from "vue-router";
// 解决 点击路由会重复报警告的问题
const originalPush = VueRouter.prototype.push;
VueRouter.prototype.push = function push(location, onResolve, onReject) {
  if (onResolve || onReject)
    return originalPush.call(this, location, onResolve, onReject);
  return originalPush.call(this, location).catch((err) => err);
};
// 注册
Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    component: () => import("@/views/layout/LayOut.vue"),
    redirect: "home",
    children: [
      {
        path: "home",
        component: () => import("@/views/layout/main.vue"),
        redirect: "/index",
      },
      {
        path: "/index",
        component: () => import("@/views/index/index.vue"),
      },
      {
        path: "/worktop",
        component: () => import("@/views/WorkTop/index.vue"),
      },
      {
        path: "/unit-input", //输入框组件
        component: () => import("@/views/unitInput/index.vue"),
      },
      {
        path: "/animation", //输入框组件
        component: () => import("../views/animation/index.vue"),
      },
      {
        path: "/number-scroll", //数字动态加载动画
        component: () => import("@/views/NumberScroll/index.vue"),
      },
      {
        path: "/light",
        component: () => import("@/views/Light/light.vue"),
      },
      {
        path: "/hexagon",
        component: () => import("@/views/Hexagon/hexagon.vue"),
      },
      {
        path: "/cascader",
        component: () => import("@/views/Cascader/index.vue"),
      },
      {
        path: "/button",
        component: () => import("@/views/Button/index.vue"),
      },
      {
        path: "/idCard",
        component: () => import("@/views/IdCard/index.vue"),
      },
      {
        path: "/fold",
        component: () => import("@/views/Fold/index.vue"),
      },
      {
        path: "/linkage",
        component: () => import("@/views/Form/index.vue"),
      },
      {
        path: "/close-select",
        component: () => import("@/views/CloseSelect/index.vue"),
      },
      {
        path: "/card-animation",
        component: () => import("@/views/cardAnimation/index.vue"),
      },
      {
        path: "/new-arr",
        component: () => import("@/views/newArr/index.vue"),
      },
    ],
  },
];

const router = new VueRouter({
  routes,
});

export default router;
